package com.cn.common.module.chat.response;

import com.cn.common.core.serial.Serializer;

import java.io.Serializable;
import java.util.UUID;

/**
 * 聊天消息
 */
public class ChatResponse extends Serializer implements Serializable{
    private String msgId = UUID.randomUUID().toString();
    /**
     * 发送者id
     */
    private String sendLoginName;

    /**
     * 发送消息用户名
     */
    private String sendUserName;
    /**
     * 发送消息的用户头像
     */
    private String sendUserHeadUrl;
    /**
     * 目标用户
     */
    private String tartgetLoginName;

    /**
     * 消息类型
     * 0 广播消息
     * 1 私聊
     * {@link ChatType}
     */
    private byte chatType;

    /**
     * 消息类型 0 文字 ，1图片
     */
    private int typeu;
    /**
     * 消息
     */
    private String message;

    /**
     * 消息发送时间
     */
    private long sendTime;

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getSendLoginName() {
        return sendLoginName;
    }

    public void setSendLoginName(String sendLoginName) {
        this.sendLoginName = sendLoginName;
    }

    public String getSendUserHeadUrl() {
        return sendUserHeadUrl;
    }

    public void setSendUserHeadUrl(String sendUserHeadUrl) {
        this.sendUserHeadUrl = sendUserHeadUrl;
    }

    public String getSendUserName() {
        return sendUserName;
    }

    public void setSendUserName(String sendUserName) {
        this.sendUserName = sendUserName;
    }

    public String getTartgetLoginName() {
        return tartgetLoginName;
    }

    public void setTartgetLoginName(String tartgetLoginName) {
        this.tartgetLoginName = tartgetLoginName;
    }

    public byte getChatType() {
        return chatType;
    }

    public void setChatType(byte chatType) {
        this.chatType = chatType;
    }

    public int getTypeu() {
        return typeu;
    }

    public void setTypeu(int typeu) {
        this.typeu = typeu;
    }

    public long getSendTime() {
        return sendTime;
    }

    public void setSendTime(long sendTime) {
        this.sendTime = sendTime;
    }

    @Override
    protected void read() {
        this.msgId = readString();
        this.sendLoginName = readString();
        this.sendUserName = readString();
        this.sendUserHeadUrl = readString();
        this.tartgetLoginName = readString();
        this.chatType = readByte();
        this.message = readString();
        this.typeu = readInt();
        this.sendTime = readLong();
    }

    @Override
    protected void write() {
        writeString(this.msgId);
        writeString(this.sendLoginName);
        writeString(this.sendUserName);
        writeString(this.sendUserHeadUrl);
        writeString(this.tartgetLoginName);
        writeByte(this.chatType);
        writeString(this.message);
        writeInt(this.typeu);
        writeLong(this.sendTime);
    }
}
                                                  